//https://leetcode.cn/problems/n-th-tribonacci-number/
int tribonacci(int n) {
    if (n == 0)
    {
        return 0;
    }
    if (n == 1)
    {
        return 1;
    }
    if (n == 2)
    {
        return 1;
    }
    int a = 0;
    int b = 1;
    int c = 1;
    int tmp = 0;
    while (n > 2)
    {
        tmp = a + b + c;
        a = b;
        b = c;
        c = tmp;
        --n;
    }
    return tmp;
}